<?php
class Administration_CacheController extends Ehl_Controller_Admin_Action {

  public function indexAction() {
    $cache = $this->getCache();
    $this->view->cache = $cache;
  }

  public function supprimerAction() {

    $request = $this->getRequest();
    $id = $request->getParam("id", "");
    $cache = $this->getCache();
    if ( $cache->test($id) ) {
      $cache->remove($id);
    }
    $this->redirect("index");
  }
  
  public function supprimertoutAction() {
    $this->desactivationRendu();
    $cache = $this->getCache();
    foreach ( $cache->getIds() as $tmp ) {
      if ( $cache->test($tmp) ) {
        $cache->remove($tmp);
      }
    }
    $this->redirect("index");
  }

  public function voirAction() {

    $request = $this->getRequest();
    if( $this->getRequest()->isGet() ) {
      $id = $this->_getParam('id', 0);
      $cache = $this->getCache();
      if (  $cache->test($id) ) {
        $val = $cache->load($id);
      } else {
        $val = __("Le cache précisé '$id' n'est plus disponible !!!");
      }
      $this->view->cache = $val;
      $this->view->tag = $id;
    }
  }
}

